#
# Copyright 2019 Fuzhou Rockchip Electronics Co., Ltd. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#

# vi: set noexpandtab syntax=cmake:

project(rkmedia_examples)

add_definitions(-g -O0 -ggdb -gdwarf -funwind-tables -rdynamic)

aux_source_directory(common COMMON_SRC)
set(THIRD_MEDIA ${CMAKE_CURRENT_LIST_DIR}/../src/rkaudio/libthird_media.so)

############################################################
# RKNN Module tests
############################################################
if(RKNN)
if(V4L2_CAPTURE)
#--------------------------
#  rkmedia_vi_rknn_venc_rtsp_test
#--------------------------
link_directories(${PROJECT_SOURCE_DIR}/libopencv_api/lib/
		${PROJECT_SOURCE_DIR}/librknn_api/lib)

add_executable( calc_mAP 
		main.cc
		./DMS-SRC/postprocess.cc)
	
target_link_libraries(calc_mAP  rknn_api m  pthread ${THIRD_MEDIA} opencv_imgproc opencv_imgcodecs opencv_core)
target_include_directories(calc_mAP PRIVATE
		${CMAKE_SOURCE_DIR}/include 
		${CMAKE_SYSROOT}/usr/include/rknn 
		${PROJECT_SOURCE_DIR}/libopencv_api/include
		${PROJECT_SOURCE_DIR}/DMS-include)
install(TARGETS calc_mAP RUNTIME DESTINATION "bin")
install(FILES rtsp-nn.cfg DESTINATION share)
install(DIRECTORY rknn_model DESTINATION share)
endif() #if(V4L2_CAPTURE)
endif() #if(RKNN)
############################################################
# ROCKX TEST
############################################################
option(COMPILES_ROCKX_TEST "Enable rockx tests" ON)
if(COMPILES_ROCKX_TEST)
  add_subdirectory(rockx_demo)
endif()

############################################################
# STRESS TEST
############################################################
option(COMPILES_STRESS_TEST "Enable stress tests" OFF)
if(COMPILES_STRESS_TEST)
  add_subdirectory(stressTest)
endif()


############################################################
# UNINT TEST
############################################################
option(COMPILES_UNIT_TEST "Enable unit tests" OFF)
if(COMPILES_UNIT_TEST)
  add_subdirectory(unitTest)
endif()
